package com.one.group.utils;

import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

/**
 * {@code @Create:}  2025-09-28  14 : 55
 * {@code @Author:} Cherry
 * {@code @ToUser:} 凡是发生,皆有利于我。
 * ------------------------------------
 * {@code @note:}
 */
public class ResponseUtils {

    public static void responseToJson(String json, HttpServletResponse response){
        try {
            //设置响应头
            response.setCharacterEncoding("UTF-8");
            response.setContentType("application/json;charset=utf-8");
            response.getWriter().write(json);
        } catch (IOException e) {
            e.printStackTrace();
            throw new RuntimeException("发送数据失败!");
        }

    }

}
